package com.luokun.vue_shop.controller;


import com.luokun.vue_shop.api.Json;
import com.luokun.vue_shop.api.Result;
import com.luokun.vue_shop.entity.SpPermission;
import com.luokun.vue_shop.mapper.SpPermissionMapper;
import com.luokun.vue_shop.model.SpPermissionModel;
import com.luokun.vue_shop.service.ISpPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@CrossOrigin(origins = "*")
@RestController
@Slf4j
@RequestMapping("/SpPermission")
public class SpPermissionController {

    @Autowired
    private ISpPermissionService iSpPermissionService;

    @RequestMapping("/menus")
    public void menus(HttpServletResponse response) throws Exception {
       List<SpPermissionModel> spPermissions= iSpPermissionService.menus();
        Result result = new Result(true, 200, "获取菜单列表成功", spPermissions);
                    Json.toJson(result, response);
    }


}
